//
//  LSRCellTopView.m
//  BaiSiProject
//
//  Created by lshenrong on 16/7/12.
//  Copyright © 2016年 lshenrong. All rights reserved.
//

#import "LSRCellTopView.h"
#import <UIImageView+WebCache.h>
#import "LSRThemeItem.h"
#import <UIKit/UIKit.h>
@class LSRCellTopView;
@interface  LSRCellTopView()
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameView;
@property (weak, nonatomic) IBOutlet UILabel *timeView;

@property (weak, nonatomic) IBOutlet UILabel *textView;
@property (weak, nonatomic) IBOutlet UIButton *topButton;

@end

@implementation LSRCellTopView

+(instancetype)cellTopView
{

    return [[[NSBundle mainBundle] loadNibNamed:@"LSRCellTopView" owner:nil options:nil] lastObject];

   

}
-(void)setItem:(LSRThemeItem *)item

{   //顶部View展示的内容
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:item.profile_image]];

    self.nameView.text=item.name;
    
    self.textView.text=item.text;
    
    self.timeView.text=item.created_at;
  
}
- (IBAction)topButtonClick:(UIButton *)sender {
    
    UIAlertController *alertController=[UIAlertController alertControllerWithTitle:nil message:@"点击收藏帖子"  preferredStyle: UIAlertControllerStyleActionSheet];
    
    
    UIAlertAction *action=[UIAlertAction actionWithTitle:@"收藏" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
       
        NSLog(@"点击了收藏");

    }];
    
    
    UIAlertAction *action1=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        NSLog(@"点击了取消");
        
    }];
    
    
    
    [alertController addAction:action];
    [alertController addAction:action1];
    
    
    [ [UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil];
    
}

@end
